<?php

/**
 * AgendaEvent form base class.
 *
 * @method AgendaEvent getObject() Returns the current form's model object
 *
 * @package    agenda
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseAgendaEventForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'          => new sfWidgetFormInputHidden(),
      'category_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('AgendaCategory'), 'add_empty' => false)),
      'title'       => new sfWidgetFormInputText(),
      'description' => new sfWidgetFormTextarea(),
      'date1'       => new sfWidgetFormDateTime(),
      'date2'       => new sfWidgetFormDateTime(),
      'schedule'    => new sfWidgetFormTextarea(),
      'pics1'       => new sfWidgetFormInputText(),
      'pics2'       => new sfWidgetFormInputText(),
      'pics3'       => new sfWidgetFormInputText(),
      'pics4'       => new sfWidgetFormInputText(),
      'url'         => new sfWidgetFormInputText(),
      'facebook'    => new sfWidgetFormTextarea(),
      'place'       => new sfWidgetFormInputText(),
      'address'     => new sfWidgetFormInputText(),
      'postcode'    => new sfWidgetFormInputText(),
      'city'        => new sfWidgetFormInputText(),
      'phone'       => new sfWidgetFormInputText(),
      'province_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('AgendaProvince'), 'add_empty' => true)),
      'prices'      => new sfWidgetFormInputText(),
      'mail'        => new sfWidgetFormInputText(),
      'created_at'  => new sfWidgetFormDateTime(),
      'updated_at'  => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'          => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'category_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('AgendaCategory'))),
      'title'       => new sfValidatorString(array('max_length' => 255)),
      'description' => new sfValidatorString(array('max_length' => 4000, 'required' => false)),
      'date1'       => new sfValidatorDateTime(),
      'date2'       => new sfValidatorDateTime(),
      'schedule'    => new sfValidatorString(array('max_length' => 4000, 'required' => false)),
      'pics1'       => new sfValidatorString(array('max_length' => 240, 'required' => false)),
      'pics2'       => new sfValidatorString(array('max_length' => 240, 'required' => false)),
      'pics3'       => new sfValidatorString(array('max_length' => 240, 'required' => false)),
      'pics4'       => new sfValidatorString(array('max_length' => 240, 'required' => false)),
      'url'         => new sfValidatorString(array('max_length' => 240, 'required' => false)),
      'facebook'    => new sfValidatorString(array('max_length' => 512, 'required' => false)),
      'place'       => new sfValidatorString(array('max_length' => 240, 'required' => false)),
      'address'     => new sfValidatorString(array('max_length' => 240, 'required' => false)),
      'postcode'    => new sfValidatorString(array('max_length' => 240)),
      'city'        => new sfValidatorString(array('max_length' => 240)),
      'phone'       => new sfValidatorString(array('max_length' => 40, 'required' => false)),
      'province_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('AgendaProvince'), 'required' => false)),
      'prices'      => new sfValidatorNumber(array('required' => false)),
      'mail'        => new sfValidatorString(array('max_length' => 240, 'required' => false)),
      'created_at'  => new sfValidatorDateTime(),
      'updated_at'  => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('agenda_event[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'AgendaEvent';
  }

}
